/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意：
* 本软件为www.yixiang.co开发研制，未经购买不得使用
* 购买后可获得全部源代码（禁止转卖、分享、上传到码云、github等开源平台）
* 一经发现盗用、分享等行为，将追究法律责任，后果自负
*/
package co.yixiang.modules.auction.service.impl;

import cn.hutool.core.util.ObjectUtil;
import co.yixiang.api.ApiResult;
import co.yixiang.api.YshopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.domain.BaseDomain;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.AuctionOrderEnum;
import co.yixiang.enums.AuctionProductEnum;
import co.yixiang.enums.BillDetailEnum;
import co.yixiang.enums.BillEnum;
import co.yixiang.modules.auction.domain.*;
import co.yixiang.modules.auction.service.*;
import co.yixiang.modules.auction.service.dto.YxAuctionConfigDto;
import co.yixiang.modules.auction.service.dto.YxAuctionRecordDto;
import co.yixiang.modules.auction.service.dto.YxAuctionRecordQueryCriteria;
import co.yixiang.modules.auction.service.mapper.YxAuctionRecordMapper;
import co.yixiang.modules.user.domain.*;
import co.yixiang.modules.user.service.YxDistributorRelationService;
import co.yixiang.modules.user.service.YxUserBankService;
import co.yixiang.modules.user.service.YxUserBillService;
import co.yixiang.modules.user.service.YxUserinfoService;
import co.yixiang.modules.user.service.mapper.UserMapper;
import co.yixiang.modules.user.service.mapper.YxAuthenticationMapper;
import co.yixiang.modules.user.service.mapper.YxDistributorEarningsMapper;
import co.yixiang.modules.user.service.mapper.YxDistributorRelationMapper;
import co.yixiang.utils.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
* @author hupeng
* @date 2020-09-15
*/
@Service
@AllArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxAuctionRecordServiceImpl extends BaseServiceImpl<YxAuctionRecordMapper, YxAuctionRecord> implements YxAuctionRecordService {

    private final IGenerator generator;
    private final YxAuctionProductService yxAuctionProductService;
    private final YxAuctionConfigService yxAuctionConfigService;
    private final YxAuctionOrderService yxAuctionOrderService;
    private final YxDistributorRelationMapper yxDistributorRelationMapper;
    private final YxUserBillService userBillService;
    private final YxUserBankService userBankService;
    private final YxUserinfoService yxUserinfoService;
    private final YxAuctionLevelService auctionLevelService;
    private final UserMapper userMapper;
    private final RedisUtils redisUtil;
    private final YxAuthenticationMapper yxAuthenticationMapper;


    @Override
    public Map<String, Object> queryAll(YxAuctionRecordQueryCriteria criteria, Pageable pageable) {
        getPage(pageable);
        PageInfo<YxAuctionRecord> page = new PageInfo<>(queryAll(criteria));
        Map<String, Object> map = new LinkedHashMap<>(2);
        map.put("content", generator.convert(page.getList(), YxAuctionRecordDto.class));
        map.put("totalElements", page.getTotal());
        return map;
    }


    @Override
    //@Cacheable
    public List<YxAuctionRecord> queryAll(YxAuctionRecordQueryCriteria criteria){
        return baseMapper.selectList(QueryHelpPlus.getPredicate(YxAuctionRecord.class, criteria));
    }


    @Override
    public void download(List<YxAuctionRecordDto> all, HttpServletResponse response) throws IOException {
        List<Map<String, Object>> list = new ArrayList<>();
        for (YxAuctionRecordDto yxAuctionRecord : all) {
            Map<String,Object> map = new LinkedHashMap<>();
            map.put("拍卖商品id", yxAuctionRecord.getAuctionProductId());
            map.put("拍卖价", yxAuctionRecord.getPrice());
            map.put("封顶价", yxAuctionRecord.getTopPrice());
            map.put("手续费", yxAuctionRecord.getServiceCharge());
            map.put("一级分佣0-10", yxAuctionRecord.getFirstCommission());
            map.put("二级分佣0-10小于一及分佣", yxAuctionRecord.getSecondCommission());
            map.put("抢拍开始时间", yxAuctionRecord.getStartTime());
            map.put("时间段", yxAuctionRecord.getTimeId());
            map.put("状态0等待补拍1补拍中2补拍完成", yxAuctionRecord.getStatus());
            map.put("转拍用户id", yxAuctionRecord.getUserId());
            map.put("是否已被购买0否1是", yxAuctionRecord.getIsBuy());
            map.put("父抢拍单id", yxAuctionRecord.getParentId());
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);
    }

    @Override
    public ApiResult<List<YxAuctionConfigDto>> findProductExample() {
        //获取所有活动
        List<YxAuctionConfigDto>  yxAuctionConfigDtos=yxAuctionConfigService.selectAll();
        for(int i=0;i<yxAuctionConfigDtos.size();i++){
            Integer type=RegaxTimeUtil.regaxTime(yxAuctionConfigDtos.get(i).getStartTime(),yxAuctionConfigDtos.get(i).getEndTime());
            yxAuctionConfigDtos.get(i).setType(type);
            //根据活动id获取所有的商品取三条
            List<YxAuctionRecordDto> yxAuctionRecordDtoList=this.baseMapper.selectByExampleProByTimeId(yxAuctionConfigDtos.get(i).getId());
            for (YxAuctionRecordDto yxAuctionRecordDto:yxAuctionRecordDtoList
                 ) {
                yxAuctionRecordDto.setYxAuctionProductDto(yxAuctionProductService.getOne(
                        new QueryWrapper<YxAuctionProduct>().lambda()
                                .eq(YxAuctionProduct::getId,yxAuctionRecordDto.getAuctionProductId())));
            }
            if(yxAuctionRecordDtoList.size()==0){
                yxAuctionConfigDtos.remove(i);
                i--;
            }else{
                yxAuctionConfigDtos.get(i).setYxAuctionRecordDto(yxAuctionRecordDtoList);
            }
        }
        //给于状态
        for (YxAuctionConfigDto auctionConfigDto: yxAuctionConfigDtos) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
            Date date= null;
            try {
                date = simpleDateFormat.parse(auctionConfigDto.getStartTime());
            } catch (ParseException e) {
                e.printStackTrace();
            }
            Date parse = null;
            try {
                String dateString = simpleDateFormat.format(new Date());
                parse = simpleDateFormat.parse(dateString);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            if(date.getTime() <= parse.getTime()){
                auctionConfigDto.setStatus(1);
            }
        }

        return ApiResult.ok(yxAuctionConfigDtos);
    }


    @Override
    public Page<YxAuctionRecordDto> getYxAuctionProductPageList(int page, int limit,String searchName, long time) {
        Page page1=new Page(page,limit);
        Page<YxAuctionRecordDto> yxAuctionProductPageList=new Page<>();

        if(Long.valueOf(0)==time){
            if(null !=searchName && !"".equals(searchName)){
                yxAuctionProductPageList=this.baseMapper.getSearchAuctionProductPageList(page1,searchName);
            }
        }else{
            yxAuctionProductPageList=this.baseMapper.getYxAuctionProductPageList(page1,searchName,time);
        }
        for (YxAuctionRecordDto yxAuctionRecordDto:yxAuctionProductPageList.getRecords()
        ) {
            YxAuctionProduct yxAuctionProduct = yxAuctionProductService.findCommonById(yxAuctionRecordDto.getAuctionProductId());
            yxAuctionRecordDto.setYxAuctionProductDto(yxAuctionProduct);
        }

        return yxAuctionProductPageList;
    }

    @Override
    public Page<YxAuctionRecordDto> getYxAuctionProductPageLists(int page, int limit,Integer isBuy, long time) {
        Page page1=new Page(page,limit);
        Page<YxAuctionRecordDto> yxAuctionProductPageList=new Page<>();

        if(Long.valueOf(0)==time){
            if(null !=isBuy && !"".equals(isBuy)){
                yxAuctionProductPageList=this.baseMapper.getSearchAuctionProductPageLists(page1,isBuy);
            }
        }else{
            yxAuctionProductPageList=this.baseMapper.getYxAuctionProductPageLists(page1,isBuy,time);
        }
        for (YxAuctionRecordDto yxAuctionRecordDto:yxAuctionProductPageList.getRecords()
        ) {
            YxAuctionProduct yxAuctionProduct = yxAuctionProductService.findCommonById(yxAuctionRecordDto.getAuctionProductId());
            yxAuctionRecordDto.setYxAuctionProductDto(yxAuctionProduct);
        }

        return yxAuctionProductPageList;
    }

    @Override
    public YxAuctionRecordDto getYxAuctionProductDetail(Long uid,Long id) {
        YxAuctionRecordDto yxAuctionRecordDto=this.baseMapper.getYxAuctionProductDetail(id);
        YxUser yxUser=userMapper.selectById(uid);

        //判断是否在vip期内
        Boolean o = false;
        Date newDate = new Date();
        Date time = yxUser.getDayCount();
        if(ObjectUtil.isNotEmpty(time)){
            if(time.getTime()>newDate.getTime()){
                o = true;
            }
        }
        if(null !=yxAuctionRecordDto){
            yxAuctionRecordDto.setYxAuctionProductDto(yxAuctionProductService.getOne(
                    new QueryWrapper<YxAuctionProduct>().lambda()
                            .eq(YxAuctionProduct::getId,yxAuctionRecordDto.getAuctionProductId())));
            YxAuctionConfig yxAuctionConfig =yxAuctionConfigService.getById(yxAuctionRecordDto.getTimeId());
            if(null !=yxAuctionConfig){
                String startTime = yxAuctionConfig.getStartTime();
                yxAuctionRecordDto.setQpStartTime(transitionTime(startTime));
                try {
                    //判断是否可以提前进场
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");//注意月份是MM
                    Date date=simpleDateFormat.parse(startTime);
                    Calendar  calendar =Calendar.getInstance();
                    calendar.setTime(date);
                    if(o){
                        calendar.add(calendar.MINUTE,-yxUser.getAfterTime());
                    }
                    //查看当前用户等级
                    YxAuctionLevel auctionLevel = auctionLevelService.getById(yxUser.getHighestLevel());
                    if(yxUser.getHighestLevel() != 0){
                        if(ObjectUtil.isNotEmpty(auctionLevel)){
                            //时间
                            calendar.add(calendar.SECOND , -auctionLevel.getAdvanceTime());
                        }
                    }
                    String newStartTime = simpleDateFormat.format(calendar.getTime());
                    //判断是否可以提前进场状态比较
                    Integer type=RegaxTimeUtil.regaxTime(newStartTime,yxAuctionConfig.getEndTime());
                    //未开始
                    if(1==type){
                        yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_1.getValue());
                    }else{
                        //已被购买
                        if(1==yxAuctionRecordDto.getIsBuy()){
                            YxAuctionOrder yxAuctionOrder=yxAuctionOrderService.getOne(new QueryWrapper<YxAuctionOrder>().lambda().eq(YxAuctionOrder::getAuctionRecordId,yxAuctionRecordDto.getId()).eq(YxAuctionOrder::getIsDel,0).ne(YxAuctionOrder::getStatus,5));
                            //为当前用户转拍,此时查看详情为我的卖单
                            if(null !=yxAuctionRecordDto.getUserId() && uid.longValue()==yxAuctionRecordDto.getUserId().longValue()){
                                //获取买家用户信息
                                if(null !=yxAuctionOrder){
                                    if(1==yxAuctionOrder.getStatus()){
                                        yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_9.getValue());
                                    }else {
                                        yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_8.getValue());
                                    }
                                }else {
                                    yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_8.getValue());
                                }
                            }else{
                                if(null !=yxAuctionOrder){
                                    if(uid !=yxAuctionOrder.getUserId()){
                                        yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_3.getValue());
                                    }else{
                                        //待付款
                                        if(0==yxAuctionOrder.getStatus()){
                                            yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_4.getValue());
                                            yxAuctionRecordDto.setTimes(yxAuctionOrder.getCreateTime().getTime()+180000-System.currentTimeMillis());
                                            //等待卖家确定收款
                                        }else if(1==yxAuctionOrder.getStatus()){
                                            yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_5.getValue());
                                            //待操作
                                        }else if(2==yxAuctionOrder.getStatus()){
                                            yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_6.getValue());
                                            //确认订单
                                        }else if(3==yxAuctionOrder.getStatus() && 2==yxAuctionOrder.getReceiveType()){
                                            yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_7.getValue());
                                        }else if(4==yxAuctionOrder.getStatus()){
                                            yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_8.getValue());
                                        }
                                        yxAuctionRecordDto.setYxAuctionOrder(yxAuctionOrder);
                                    }
                                }else{
                                    yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_3.getValue());
                                }
                            }
                        }else{
                            if(3==type){
                                yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_8.getValue());
                            }else{
                                yxAuctionRecordDto.setType(AuctionProductEnum.TYPE_2.getValue());
                            }
                        }
                    }
                }catch (Exception e){
                    throw new YshopException("该单存在问题");
                }
            }
        }
        return yxAuctionRecordDto;
    }

    private String transitionTime(String sTime){
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        // 时
        calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(sTime.split(":")[0]));
        // 分
        calendar.set(Calendar.MINUTE, Integer.valueOf(sTime.split(":")[1]));
        // 秒
        calendar.set(Calendar.SECOND, 0);
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return df.format(calendar.getTime());
    }

    @Override
    public Page<YxAuctionRecordDto> orderPage(Long uid, Integer type,int page,int limit) {
        Page page1=new Page(page,limit);
        Page<YxAuctionRecordDto> yxAuctionProductPageList=new Page<YxAuctionRecordDto>();
        List<YxAuctionConfigDto> yxAuctionConfigDtos = yxAuctionConfigService.selectAll();
        //等待转拍
        if(1==type){
            List<Long> timeId=new ArrayList<>();
            for (int i=0;i<yxAuctionConfigDtos.size();i++) {
                YxAuctionConfigDto yxAuctionConfigDto=yxAuctionConfigDtos.get(i);
                Integer sign=RegaxTimeUtil.regaxTime(yxAuctionConfigDto.getStartTime(),yxAuctionConfigDto.getEndTime());
                if(1==sign){
                    timeId.add(yxAuctionConfigDto.getId());
                }
            }
            if(timeId.size()>0){
                yxAuctionProductPageList=this.baseMapper.waitOrderPage(page1,uid, StringUtils.join(timeId, ","));
            }else{
                yxAuctionProductPageList=this.baseMapper.waitOrderPageByTime(page1,uid);
            }
        }else  if(2==type){
            yxAuctionProductPageList=this.baseMapper.inOrderPage(page1,uid);
        }else if(3==type){
            yxAuctionProductPageList=this.baseMapper.confirmOrderPage(page1,uid);
        }else{
            yxAuctionProductPageList=this.baseMapper.overOrderPage(page1,uid);
        }
        for (YxAuctionRecordDto yxAuctionRecordDto:yxAuctionProductPageList.getRecords()) {
            yxAuctionRecordDto.setYxAuctionProductDto(yxAuctionProductService.getOne(
                    new QueryWrapper<YxAuctionProduct>().lambda()
                            .eq(YxAuctionProduct::getId,yxAuctionRecordDto.getAuctionProductId())));
        }
        return yxAuctionProductPageList;
    }

    @Override
    public YxAuctionRecordDto productReocrdDetail(Long uid, Long id) {
        YxAuctionRecordDto yxAuctionRecordDto= this.baseMapper.productReocrdDetail(id,uid);
        if(null !=yxAuctionRecordDto){
            YxAuctionConfig yxAuctionConfig =yxAuctionConfigService.getById(yxAuctionRecordDto.getTimeId());
            SimpleDateFormat sdf=new SimpleDateFormat("YYYY-MM-dd");
            String nowDate=sdf.format(new Date());
            //判断开始时间是否大于当前时间，大于则证明为等待转拍
            yxAuctionRecordDto.setStartDate(yxAuctionConfig.getStartTime());
            if(yxAuctionRecordDto.getStartTime().compareTo(nowDate)>0){
                yxAuctionRecordDto.setType(1);
            }else{
                Integer type=RegaxTimeUtil.regaxTime(yxAuctionConfig.getStartTime(),yxAuctionConfig.getEndTime());
                //当天
                if(yxAuctionRecordDto.getStartTime().compareTo(nowDate)==0){
                    //等待转拍
                    if(1==type){
                        yxAuctionRecordDto.setType(1);
                    }else if(2==type){
                        //转拍中
                        if(yxAuctionRecordDto.getStatus()<2){
                            yxAuctionRecordDto.setType(2);
                            //待确定
                        }else if(yxAuctionRecordDto.getStatus()==2){
                            yxAuctionRecordDto.setType(3);
                        }else{
                            yxAuctionRecordDto.setType(4);
                        }
                    }else{
                        //转拍中
                        if(yxAuctionRecordDto.getStatus()<2){
                            yxAuctionRecordDto.setType(2);
                            //待确定
                        }else if(yxAuctionRecordDto.getStatus()==2){
                            yxAuctionRecordDto.setType(3);
                        }else{
                            yxAuctionRecordDto.setType(4);
                        }
                    }
                }else{
                    //等待转拍
                    if(yxAuctionRecordDto.getStatus()<2){
                        yxAuctionRecordDto.setType(1);
                        //待确定
                    }else if(yxAuctionRecordDto.getStatus()==2){
                        yxAuctionRecordDto.setType(3);
                    }else{
                        yxAuctionRecordDto.setType(4);
                    }
                }
            }
            if(1==yxAuctionRecordDto.getIsBuy()){
                //买家
                YxAuctionOrder yxAuctionOrder=yxAuctionOrderService.getOne
                        (new QueryWrapper<YxAuctionOrder>().lambda()
                                .eq(YxAuctionOrder::getAuctionRecordId,yxAuctionRecordDto.getId()).ne(YxAuctionOrder::getStatus,5).eq(YxAuctionOrder::getIsDel,0));
                if(null !=yxAuctionOrder){
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    if (ObjectUtil.isNotEmpty(yxAuctionOrder.getPayTime())){
                        yxAuctionRecordDto.setPayTime(simpleDateFormat.format(yxAuctionOrder.getPayTime()));
                    }
                    YxUser yxUser=userMapper.selectById(yxAuctionOrder.getUserId());
                    yxAuctionRecordDto.setPhone(yxUser.getPhone());
                    YxAuthentication yxAuthentication=yxAuthenticationMapper.selectByUid(yxUser.getUid());
                    if(null !=yxAuthentication && 1==yxAuthentication.getStatus()){
                        yxAuctionRecordDto.setRealName(yxAuthentication.getRealName());
                    }
                    yxAuctionRecordDto.setNickname(yxUser.getNickname());
                }

                //卖家基本信息
                YxUser yxUser1=userMapper.selectById(yxAuctionRecordDto.getUserId());
                if(null !=yxUser1){
                    yxAuctionRecordDto.setBuyPhone(yxUser1.getPhone());
                    YxAuthentication yxAuthentication1=yxAuthenticationMapper.selectByUid(yxUser1.getUid());
                    if(null !=yxAuthentication1 && 1==yxAuthentication1.getStatus()){
                        yxAuctionRecordDto.setBuyRealName(yxAuthentication1.getRealName());
                    }
                    yxAuctionRecordDto.setBuyNickName(yxUser1.getNickname());
                    //账户收款码
                    YxUserinfo userinfo1 = yxUserinfoService.getOne(new QueryWrapper<YxUserinfo>().lambda()
                            .eq(YxUserinfo::getUid, yxUser1.getUid()));
                    if(ObjectUtil.isNotEmpty(userinfo1)){
                        yxAuctionRecordDto.setBindZfb(userinfo1.getBindZfb());
                        yxAuctionRecordDto.setZhifubaoName(userinfo1.getZhifubaoName());
                        yxAuctionRecordDto.setZhifubaoCode(userinfo1.getZhifubaoCode());
                        yxAuctionRecordDto.setBindWx(userinfo1.getBindWx());
                        yxAuctionRecordDto.setWeixinName(userinfo1.getWeixinName());
                        yxAuctionRecordDto.setWeixinCode(userinfo1.getWeixinCode());
                        YxUserBank one = userBankService.getOne(new QueryWrapper<YxUserBank>().lambda()
                                .eq(YxUserBank::getUid, userinfo1.getUid()));
                        if(ObjectUtil.isNotEmpty(one)){
                            yxAuctionRecordDto.setBindBank(1);
                            yxAuctionRecordDto.setBankName(one.getBankName());
                            yxAuctionRecordDto.setBankNum(one.getBankNumber());
                            yxAuctionRecordDto.setBankRealName(one.getRealName());
                            yxAuctionRecordDto.setBankCode(one.getBankCode());
                        }
                    }
                }

            }
            yxAuctionRecordDto.setYxAuctionProductDto(yxAuctionProductService.getOne(
                    new QueryWrapper<YxAuctionProduct>().lambda()
                            .eq(YxAuctionProduct::getId,yxAuctionRecordDto.getAuctionProductId())));
        }
        return yxAuctionRecordDto;
    }

    @Override
    public ApiResult<Object> confirmPay(Long uid, Long id) {
        YxAuctionRecord yxAuctionRecord=this.baseMapper.selectById(id);
        if(null==yxAuctionRecord){
            throw new YshopException("订单不存在");
        }
        if(uid.longValue() !=yxAuctionRecord.getUserId().longValue()){
            throw new YshopException("该卖单不属于该用户");
        }
        if(2!= yxAuctionRecord.getStatus()){
            throw new YshopException("该卖单状态不为待确定状态");
        }
        //修改卖单表
        yxAuctionRecord.setStatus(AuctionProductEnum.TYPE_3.getValue());
        this.baseMapper.updateById(yxAuctionRecord);
        //查询买家订单
        YxAuctionOrder yxAuctionOrder=yxAuctionOrderService.selectByAuctionRecord(yxAuctionRecord.getId());
        //修改买家订单
        if(null !=yxAuctionOrder){
            if(1 !=yxAuctionOrder.getStatus()){
                throw new YshopException("订单状态有误");
            }
            yxAuctionOrder.setStatus(AuctionOrderEnum.TYPE_2.getValue());
            yxAuctionOrderService.updateById(yxAuctionOrder);
        }

        //推送给买家
        YxUser user = userMapper.selectById(yxAuctionOrder.getUserId());
        if (ObjectUtil.isNotEmpty(user)) PushtoSingle.sendToAlias("卖家已确认","卖家已确认，请继续操作",user.getClientId(),1,1L);


        return ApiResult.ok("确认收款成功");
    }

    @Override
    public List<YxAuctionRecord> selectNoBuy() {
        return this.baseMapper.selectNoBuy();
    }

    @Override
    public String getStartTime(Long valueOf) {
        YxAuctionConfig byId = yxAuctionConfigService.getById(valueOf);
        return transitionTime(byId.getStartTime());
    }
}
